package com.luchao.springcloud;

import com.luchao.springcloud.service.DeptClientService;
import com.luchao.springcloudapi.pojo.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class DeptConsumerController {

    @Autowired
    DeptClientService deptClientService;

    @RequestMapping("/consumer/dept/add")
    public boolean add(Dept dept) {
        return deptClientService.addDept(dept);
    }

    @RequestMapping("/consumer/dept/getById/{id}")
    public Dept getById(@PathVariable("id") Long id) {
        return deptClientService.getById(id);
    }

    @RequestMapping("/consumer/dept/getList")
    public List<Dept> getList() {
        return deptClientService.getlist();
    }

}
